import requests from "./request";
import mockRequests from "./mockRequest";

//三级列表数据
export const reqCategoryList = () => {
  return requests({ url: "product/getBaseCategoryList", method: "get" });
};

export const reqSearchList = (params) =>
  requests({ url: "/list", method: "post", data: params });

export const mockReqBannerList = () => {
  return mockRequests({ url: "/banner", method: "get" });
};
export const mockReqFloorList = () => {
  return mockRequests({ url: "/floor", method: "get" });
};

export const reqGoodsInfo = (skuId) => {
  return requests({ url: `/item/${skuId}`, method: "get" });
};

export const reqAddOrShopCar = (skuId, skuNum) => {
  return requests({
    url: `/cart/addToCart/${skuId}/${skuNum}`,
    method: "post",
  });
};

export const reqCartList = () => {
  return requests({ url: "/cart/cartList", method: "get" });
};

export const reqDeleteCart = (skuId) => {
  return requests({ url: `/cart/deleteCart/${skuId}`, method: "DELETE" });
};

export const reqUpdataCartListIsChecked = (skuId, isChecked) => {
  return requests({
    url: `/cart/checkCart/${skuId}/${isChecked}`,
    method: "get",
  });
};

export const reqPhoneCode = (phone) => {
  return requests({ url: `/user/passport/sendCode/${phone}`, method: "get" });
};

export const reqRegUser = (data) => {
  return requests({ url: "/user/passport/register", data, method: "post" });
};

export const reqUserLogin = (data) => {
  return requests({ url: "/user/passport/login", data, method: "post" });
};

export const reqUserInfo = () => {
  return requests({ url: "user/passport/auth/getUserInfo", method: "get" });
};

export const reqLoginOut = () => {
  return requests({ url: "/user/passport/logout", method: "get" });
};

// export const reqAddressInfo = () => requests({ url: `/user/userAddress/auth/findUserAddressList`, method: 'get' });
//地址模拟数据
export const reqAddressInfo = () =>
  mockRequests({ url: `/Address`, method: "get" });
//home模块的like模拟数据
export const reqlikeInfo = () => mockRequests({ url: `/like`, method: "get" });
//brand数据模拟
export const reqbrandInfo = () =>
  mockRequests({ url: `/brand`, method: "get" });
//recommend数据模拟
export const reqrecommendInfo = () =>
  mockRequests({ url: `/recommend`, method: "get" });
//rank数据模拟
export const reqrankInfo = () => mockRequests({ url: `/rank`, method: "get" });
//newswiper数据模拟
export const reqnewswiperInfo = () =>
  mockRequests({ url: `/newswiper`, method: "get" });
//nswiper3D数据模拟
export const reqswiper3DInfo = () =>
mockRequests({ url: `/swiper3D`, method: "get" });
//Shop数据
export const reqShopInfo = () =>
  requests({ url: `/order/auth/trade`, method: "get" });
//threeD数据和模型:
export const reqthreeDInfo = () =>
  mockRequests({ url: `/threeD`, method: "get" });
//Submit数据
export const reqSubmitOrder = (tradeNo, data) =>
  requests({
    url: `/order/auth/submitOrder?tradeNo=${tradeNo}`,
    method: "post",
    data,
  });

//Pay数据
export const reqPayInfo = (orderId) =>
  requests({ url: `/payment/weixin/createNative/${orderId}`, method: "get" });

//PayStatus数据
export const reqPayStatus = (orderId) =>
  requests({ url: `/payment/weixin/queryPayStatus/${orderId}`, method: "get" });

export const reqMyOrderList = (page, limit) =>
  requests({ url: `/order/auth/${page}/${limit}`, method: "get" });
